package pl.iachoo.ctl.tabory.ui.base;

import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;

public class CommonValidationUtil {

	public static KeyAdapter getValidationDoubleKeyAdapter() {
		KeyAdapter adapter = new KeyAdapter() {
			@Override
			public void keyPressed(KeyEvent e) {
				if (e.character != '.') {
					if (!Character.isDigit(e.character)) {
						e.doit = false;
					}
				}
			}
		};
		return adapter;
	}
}
